<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Gestore Clienti</title>
        <ui:include src="Header.xhtml"/>
    </h:head>
    <h:body>
         
        <div>
            <h:form>
                <p:dataTable id="table" var="clienti" value="#{clienteManagedBean.cliente}" emptyMessage="Non ci sono clienti registrati">
                     <f:facet name="header">
                            <p:outputLabel value="Lista Clienti"/>
                        </f:facet>
                   <p:column headerText="#ID" width="30">
                       <p:outputLabel value="#{clienti.id}"/>

                   </p:column>
                    
                     <p:column headerText="Cognome" width="80">
                         <p:outputLabel value="#{clienti.cognome}"/>
                     </p:column>
                    
                     <p:column headerText="Nome" width="80">
                         <p:outputLabel value="#{clienti.nome}"/>
                     </p:column>
                     <p:column headerText="Username"  width="80">
                         <p:outputLabel value="#{clienti.username}"/>
                        </p:column>
                    <p:column  headerText="Stato" width="60">
                        <p:outputLabel value="#{clienti.stato}"/>
                        </p:column>
                    <p:column width="120">
                        <p:commandButton value="Attiva Utente"  style="font-size: 15px" actionListener="#{clienteManagedBean.attivaCliente(clienti)}" update="table"/>
                        </p:column>
                        <p:column width="120">
                        <p:commandButton value="Blocca Utente" style="font-size: 15px" actionListener="#{clienteManagedBean.bloccaCliente(clienti)}" update="table"/>
                        </p:column>
                    <p:column width="120">
                        <p:commandButton value="Promuovi a Gestore Magazzino" style="font-size: 15px" actionListener="#{clienteManagedBean.promuoviCliente(clienti)}" update="table"/>
                        </p:column>
                    <p:column width="120">
                        <p:commandButton value="Rimuovi Utente" icon="ui-icon-trash" style="font-size: 15px" actionListener="#{clienteManagedBean.eliminaCliente(clienti)}" update="table"/>
                        </p:column>
                    
                    
                </p:dataTable>
                
            </h:form>
            
        </div>
        
        <div>
            <h:form>
                <p:dataTable id="tablegestori" var="gestori" value="#{gestoreManagedBean.gestore}" emptyMessage="Non sono presenti gestori magazzino">
                     <f:facet name="header">
                            <p:outputLabel value="Lista Gestore Magazzino"/>
                        </f:facet>
                   <p:column headerText="#ID" width="30">
                       <p:outputLabel value="#{gestori.id}"/>

                   </p:column>
                    
                     <p:column headerText="Cognome">
                         <p:outputLabel value="#{gestori.cognome}"/>
                     </p:column>
                    
                     <p:column headerText="Nome">
                         <p:outputLabel value="#{gestori.nome}"/>
                     </p:column>
                     <p:column headerText="Username">
                         <p:outputLabel value="#{gestori.username}"/>
                        </p:column>
                    <p:column headerText="Password">
                         <p:outputLabel value="#{gestori.password}"/>
                        </p:column>
                    
                        <p:column >
                        <p:commandButton value="Rimuovi Gestore" icon="ui-icon-trash" style="font-size: 15px" actionListener="#{gestoreManagedBean.rimuoviGestori(gestori)}" update="tablegestori"/>
                        </p:column>
                    
                    
                </p:dataTable>
                
            </h:form>
            
        </div>
        <div>
            <h:form>
                <p:dataTable id="tableamministratori" var="amministratori" value="#{amministratoreManagedBean.amministratore}" emptyMessage="Non sono presenti amministratori">
                     <f:facet name="header">
                            <p:outputLabel value="Lista Amministratori"/>
                        </f:facet>
                   <p:column headerText="#ID" width="30">
                       <p:outputLabel value="#{amministratori.id}"/>
                    </p:column>
                                  
                     <p:column headerText="Cognome">
                         <p:outputLabel value="#{amministratori.cognome}"/>
                     </p:column>
                    
                     <p:column headerText="Nome">
                         <p:outputLabel value="#{amministratori.nome}"/>
                     </p:column>
                     <p:column headerText="Username">
                         <p:outputLabel value="#{amministratori.username}"/>
                        </p:column>
                      <p:column headerText="Password">
                         <p:outputLabel value="#{amministratori.password}"/>
                        </p:column>
                    
              
                                          
                    
                </p:dataTable>
                
            </h:form>
            
        </div>
            
    </h:body>
</html>


